package cn.wolfcode.luowowo.search.query;

import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;


@Getter
@Setter
public class SearchQueryObject extends StrategySearchQuery {

    public static final int TYPE_ALL = -1;
    public static final int TYPE_DEST = 0;
    public static final int TYPE_STRATEGY = 1;
    public static final int TYPE_TRAVEL = 2;
    public static final int TYPE_USER = 3;


    private String keyword;

    private int type = -1;

    public String getKeyword(){
        return StringUtils.hasLength(this.keyword)?this.keyword:null;
    }

    //分页对象
    public Pageable getPageable(){
        return PageRequest.of(super.getCurrentPage() - 1, super.getPageSize());
    }
}
